package org.qf.web;

import org.qf.service.impl.SmbmsGoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zzzyyystart
 * @create 2022-05-12-23:39
 */
@WebServlet(value = "/deleteGoodsServlet")
public class SmbmsDeleteGoodsServlet extends HttpServlet {
    SmbmsGoodsServiceImpl goodsService = new SmbmsGoodsServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String goodsId = req.getParameter("id");
        String classifyName = req.getParameter("classify");
        int i = goodsService.deleteGoods(goodsId, classifyName);
        if(i>0){
            resp.sendRedirect("goodsServlet?classify="+classifyName);
        }



    }
}
